﻿/******************************************************************************
* Copyright 2016 tian xianglong. All rights reserved.
*******************************************************************************
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************
* 对象声明

******************************************************************************/

#pragma once

#ifndef UNICODE
#define UNICODE
#endif

#ifndef _UNICODE
#define _UNICODE
#endif

#include <basetsd.h>

#ifdef __cplusplus
extern "C" {
#endif


	// 对象类型
#define OT_NODE		1
#define OT_TEXTURE	2
#define OT_GLYPH	3

// 对象
typedef struct OBJECT_
{
	INT64 m_nID;
	INT64 m_nType; // 对象类型
} OBJECT, *LPOBJECT;

// 场景节点
typedef struct NODE_
{
	OBJECT	base;
	INT64	m_nObject; // 节点（场景节点）都需要附着一个实际的对象才能被绘制。
} NODE, *LPNODE;

// 纹理
typedef struct TEXTURE_
{
	OBJECT	base;
	INT64	m_nFormat; // 纹理格式
	INT64	m_nWidth;
	INT64	m_nHeight;
	WCHAR	m_nFilePath[_MAX_PATH];
} TEXTURE, *LPTEXTURE;

/* 图形符号私有数据 */
struct glyph_private_data
{
	int max_advance;
	int cy;
	int vcount;
	int hcount;
	int bmp_width;
	int bmp_height;
	int pitch;
	int cb;
	BYTE *gray_bmp; /* 灰度位图 */
};

#define GLYPH_MAX_CHAR_COUNT			(100)
#define GLYPH_DEFAULT_SIZE				(40)
#define F26DOT6_TO_INT					(64)

// 图形符号
typedef struct glyph
{
	OBJECT	base;
	WCHAR	char_codes[GLYPH_MAX_CHAR_COUNT];		/* 包含的字符(UCS-2 LE) */
	int		char_count;					/* 字符个数 */
	WCHAR	font_file_path[MAX_PATH];	/* 字体文件路径(*.ttc, *.ttf) */
	INT64	font_size;					/* 字号 */
	INT64	bitmap_size;				/* 大位图尺寸，2的幂 */
	int	glyph_width;				/* 字符位图宽 */
	int glyph_height;				/* 字符位图高 */
	
	struct glyph_private_data	*data;
} GLYPH, *LPGLYPH;


#ifdef __cplusplus
}
#endif

